]> dgit.raspbian.org Git - gnome-shell.git/commit
Keep similar theme nodes so we don't have to recompute CSS so often
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 8 Nov 2012 17:50:01 +0000 (17:50 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 14 Nov 2012 19:24:42 +0000 (19:24 +0000)
commitdc2ec0a8f95baa21aa460d49ed1ac36d398f62f4
treeafc41385baca3394aa9bdd878357a3ebdd38c20a
parent2cfed952bbbc0730d300fd6dd8ba6e259c880cc3
Keep similar theme nodes so we don't have to recompute CSS so often

Because we calculate and cache CSS properties once per StThemeNode,
and only a certain set of attributes can affect the CSS properties,
it's advantageous for as many widgets as possible to share a single
StThemeNode. Similarly, if a widget changes state and then changes back
(e.g. gaining and losing the :hover pseudo-class), it should ideally
get its original StThemeNode back again when it returns to the old
state.

Here, I'm using the StThemeContext as the location for a cache.
StThemeNodes are currently never freed: this seems OK for Shell's usage
(a finite number of IDs, classes, pseudo-classes and types).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687465
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
src/st/st-theme-context.c
src/st/st-theme-context.h
src/st/st-theme-node.c
src/st/st-theme-node.h
src/st/st-widget.c